package com.zhuoyue.biz.core.command.cmd.common.faa;

import com.zhuoyue.biz.core.api.domain.DeviceAndGatewayDO;
import com.zhuoyue.biz.core.api.dto.req.ControlReq;
import com.zhuoyue.biz.core.command.cmd.common.faa.base.BaseCmd;
import com.zhuoyue.biz.core.command.model.InsertCardGetElectricCmd;


/**
 * @author Administrator
 */
public class PlugInCardGetPower0Faa8106 extends BaseCmd {
    private static final String SET_TIME_DATA = "0201${gatewayMac}${deviceMac}03EF1401${time}";
    private static final String SELECT_CHECK_DATA = "0101${gatewayMac}${deviceMac}03EF00";

    public static String set(DeviceAndGatewayDO deviceAndGatewayDO, ControlReq controlReq) {
        String cmd;
        String gatewayMac = deviceAndGatewayDO.getGatewayMac();
        String zigbeeMac = deviceAndGatewayDO.getZigbeeMac();
        int time = (int) controlReq.getActions().get("time");
        String cmd1 = new InsertCardGetElectricCmd(gatewayMac, zigbeeMac, time)
                .getCmd(SET_TIME_DATA);
        String cmd2 = new InsertCardGetElectricCmd(gatewayMac, zigbeeMac).getCmd(SELECT_CHECK_DATA);
        cmd = cmd1 + cmd2;
        return cmd;
    }
}
